<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateStatisticsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('statistics', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('type')->default(1);
            $table->integer('add_users_count')->default(0);
            $table->integer('users_count')->default(0);
            $table->integer('goods_count')->default(0);
            $table->integer('orders_count')->default(0);
            $table->integer('orders_add_count')->default(0);
            $table->integer('orders_add_pay_count')->default(0);
            $table->integer('orders_return_count')->default(0);
            $table->decimal('orders_return_amount', 10, 2)->default(0);
            $table->decimal('orders_return_rate', 10, 2)->default(0);
            $table->integer('repurchase_count')->default(0);
            $table->decimal('repurchase_rate', 10, 2)->default(0);
            $table->decimal('orders_price_amount', 10, 2)->default(0);
            $table->decimal('orders_pay_money_amount', 10, 2)->default(0);
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('statistics');
    }
}
